﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class modify : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GridView1.Visible = false;
            GridView2.Visible = false;
            GridView3.Visible = false;
        }
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        GridView1.Visible = true;
        GridView2.Visible = false;
        GridView3.Visible = false;
    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        GridView1.Visible = false;
        GridView2.Visible = true;
        GridView3.Visible = false;
    }
    protected void LinkButton3_Click(object sender, EventArgs e)
    {
        GridView1.Visible = false;
        GridView2.Visible = false;
        GridView3.Visible = true;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //修改学生信息
        if (GridView1.Visible)
        {
            SqlDataSource1.SelectCommand = "select * from student where sno='" + TextBox1.Text.ToString() + "'";
            GridView1.Visible = true;
        }
        //修改老师信息
        if (GridView2.Visible)
        {
            SqlDataSource2.SelectCommand = "select * from teacher where tno='" + TextBox1.Text.ToString() + "'";
            GridView2.Visible = true;
        }
        //修改课程信息
        if (GridView3.Visible)
        {
            SqlDataSource3.SelectCommand = "select * from course where cno='" + TextBox1.Text.ToString() + "'";
            GridView3.Visible = true;
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}